#######################################################################################################################
import json


#######################################################################################################################
misptemp_name = 'misptemp'
mispfile_name = 'mispfile'
source_name = 'source.src'
target_name = 'target.trg'


#######################################################################################################################
# init misp data
misp_data = {}
misp_data['configs'] = {}
configs = misp_data['configs']
misp_data['phases'] = []
phases = misp_data['phases']

# add configs
configs['clean_config'] = []
configs['build_config'] = []

# add clean phase
phase_id = 'clean_phase'
configs['clean_config'].append(phase_id)
phases.append({
	'id': phase_id,
	'formulas': {},
	})
formulas = phases[-1]['formulas']
# add clean formula
formulas['clean_formula'] = {
		'actions' : [
			['-s', 'del %s' % target_name],
			['-s', 'del %s' % mispfile_name],
		]
	}

# add build phase
phase_id = 'build_phase'
configs['build_config'].append(phase_id)
phases.append({
	'id': phase_id,
	'formulas': {},
	})
formulas = phases[-1]['formulas']
# add build formula
formulas['build_formula'] = {
		'sources': [ source_name ],
		'targets': [ target_name ],
		'actions' : [
			['s', 'copy /y %s %s' % (source_name, target_name)],
		]
	}

# write mispfile
ofile = open(misptemp_name, 'wt')
json.dump(misp_data, ofile, indent=4, sort_keys=True)
ofile.close()
